import 'package:json_annotation/json_annotation.dart';

part 'wrong_question.g.dart';

@JsonSerializable()
class WrongQuestion {
  final String id;
  final String wordId;
  final String question;
  final List<String> options;
  final int correctIndex;
  final int selectedIndex;
  final DateTime wrongAt;
  final int attemptCount;

  const WrongQuestion({
    required this.id,
    required this.wordId,
    required this.question,
    required this.options,
    required this.correctIndex,
    required this.selectedIndex,
    required this.wrongAt,
    this.attemptCount = 1,
  });

  factory WrongQuestion.fromJson(Map<String, dynamic> json) =>
      _$WrongQuestionFromJson(json);

  Map<String, dynamic> toJson() => _$WrongQuestionToJson(this);

  WrongQuestion copyWith({
    String? id,
    String? wordId,
    String? question,
    List<String>? options,
    int? correctIndex,
    int? selectedIndex,
    DateTime? wrongAt,
    int? attemptCount,
  }) {
    return WrongQuestion(
      id: id ?? this.id,
      wordId: wordId ?? this.wordId,
      question: question ?? this.question,
      options: options ?? this.options,
      correctIndex: correctIndex ?? this.correctIndex,
      selectedIndex: selectedIndex ?? this.selectedIndex,
      wrongAt: wrongAt ?? this.wrongAt,
      attemptCount: attemptCount ?? this.attemptCount,
    );
  }
} 